import cache from "../enum/cache";
import Http from "../utils/http";
import Token from "./token"

class User{
  static getUserInfoByLocal(){
    return wx.getStorageSync(cache.USER_INFO)
  }

  static async login(){
      // 获取令牌 
    const token = await Token.getToken();
    wx.setStorageSync(cache.TOKEN, token)
  }

  static async updateUserInfo(userInfo){
  //  const res = await Http.request({
  //     url:'v1/user',
  //     data:{
  //       nickname:userInfo.nickName,
  //       avatar:userInfo.avatarUrl,
  //       gender:userInfo.gender
  //     },
  //     method:'put'
  //   })
  console.log('没有更新用户信息,本地信息以存入缓存');

    wx.setStorageSync(cache.USER_INFO, userInfo)
  }

}

export default User